package com.wswy.wzcx.ui.web;

import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.NonNull;

public class WebPageArgument implements Parcelable {

  private String url;

  private String title;

  private boolean showToolBar = true;

  private boolean showAd;
  private boolean showShare;

  private boolean showUrlTitle = true;

  private boolean addToken;

  //显示底部嵌套ad
  private boolean showNestedAd = false;
  //显示底部banner ad
  private boolean showBannerAd = false;

  private String referer = null;
  private boolean h5Pay = false;

  public WebPageArgument(@NonNull String url) {
    this.url = url;
  }

  protected WebPageArgument(Parcel in) {
    url = in.readString();
    title = in.readString();
    showToolBar = in.readByte() != 0;
    showAd = in.readByte() != 0;
    showShare = in.readByte() != 0;
    showUrlTitle = in.readByte() != 0;
    addToken = in.readByte() != 0;
    showNestedAd = in.readByte() != 0;
    showBannerAd = in.readByte() != 0;
    referer = in.readString();
    h5Pay = in.readByte() != 0;
  }

  @Override
  public void writeToParcel(Parcel dest, int flags) {
    dest.writeString(url);
    dest.writeString(title);
    dest.writeByte((byte) (showToolBar ? 1 : 0));
    dest.writeByte((byte) (showAd ? 1 : 0));
    dest.writeByte((byte) (showShare ? 1 : 0));
    dest.writeByte((byte) (showUrlTitle ? 1 : 0));
    dest.writeByte((byte) (addToken ? 1 : 0));
    dest.writeByte((byte) (showNestedAd ? 1 : 0));
    dest.writeByte((byte) (showBannerAd ? 1 : 0));
    dest.writeString(referer);
    dest.writeByte((byte) (h5Pay ? 1 : 0));
  }

  @Override
  public int describeContents() {
    return 0;
  }

  public static final Creator<WebPageArgument> CREATOR = new Creator<WebPageArgument>() {
    @Override
    public WebPageArgument createFromParcel(Parcel in) {
      return new WebPageArgument(in);
    }

    @Override
    public WebPageArgument[] newArray(int size) {
      return new WebPageArgument[size];
    }
  };

  public String getUrl() {
    return url;
  }


  public String getTitle() {
    return title;
  }

  public WebPageArgument setTitle(String title) {
    this.title = title;
    return this;
  }

  public boolean isShowToolBar() {
    return showToolBar;
  }

  public WebPageArgument setShowToolBar(boolean showToolBar) {
    this.showToolBar = showToolBar;
    return this;
  }

  public boolean isShowAd() {
    return showAd;
  }

  public WebPageArgument setShowAd(boolean showAd) {
    this.showAd = showAd;
    return this;
  }

  public boolean isShowShare() {
    return showShare;
  }

  public WebPageArgument setShowShare(boolean showShare) {
    this.showShare = showShare;
    return this;
  }

  public boolean isShowUrlTitle() {
    return showUrlTitle;
  }

  public WebPageArgument setShowUrlTitle(boolean showUrlTitle) {
    this.showUrlTitle = showUrlTitle;
    return this;
  }

  public boolean isAddToken() {
    return addToken;
  }

  public WebPageArgument setAddToken(boolean addToken) {
    this.addToken = addToken;
    return this;
  }

  public boolean isShowNestedAd() {
    return showNestedAd;
  }

  public WebPageArgument setShowNestedAd(boolean showNestedAd) {
    this.showNestedAd = showNestedAd;
    return this;
  }

  public boolean isShowBannerAd() {
    return showBannerAd;
  }

  public WebPageArgument setShowBannerAd(boolean showBannerAd) {
    this.showBannerAd = showBannerAd;
    return this;
  }


  public WebPageArgument setReferer(String referer) {
    this.referer = referer;
    return this;
  }

  public String getReferer() {
    return referer;
  }

  public WebPageArgument setH5Pay(boolean h5Pay) {
    this.h5Pay = h5Pay;
    return this;
  }
  public boolean isH5Pay() {
    return h5Pay;
  }
}
